package com.hsylient.translator.gpt;

import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;

import java.util.List;

public class ReplaceContext {

    private static final String RESOURCE = "C:\\Users\\Hsylient\\Desktop\\xxx\\SUPEREX-FRENCHTranslation.xlsx";

    private static final Integer SHEET_INDEX = 1;
    private static final ExcelReader reader = ExcelUtil.getReader(RESOURCE, SHEET_INDEX);
    private static final ExcelWriter writer = ExcelUtil.getWriter(RESOURCE, "前端翻译");


    public static void main(String[] args) {
        reader.setIgnoreEmptyRow(false);
        List<Object> objects = reader.readColumn(11, 1);
        for (int i = 0; i < objects.size(); i++) {
            if (objects.get(i) != null && StrUtil.isNotBlank(objects.get(i).toString()) && !objects.get(i).toString().equals("0")) {
                writer.writeCellValue(10, i + 1, objects.get(i));
            }
        }
        writer.flush();
    }
}
